import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const CurrentAlertMeta: IPublicTypeComponentMetadata = {
  componentName: 'CurrentAlert',
  title: '当前预警',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'CurrentAlert',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '背景颜色'
    },
    {
      name: 'backgroundOpacity',
      propType: 'number',
      description: '背景透明度'
    },
    {
      name: 'iconPath',
      propType: 'string',
      description: '图标路径'
    },
    {
      name: 'alertText',
      propType: 'string',
      description: '预警文字'
    },
    {
      name: 'alertTextColor',
      propType: 'string',
      description: '预警文字颜色'
    },
    {
      name: 'alertFontSize',
      propType: 'number',
      description: '预警文字大小'
    },
    {
      name: 'alertFontWeight',
      propType: 'string',
      description: '预警文字粗细'
    },
    {
      name: 'alertLetterSpacing',
      propType: 'string',
      description: '预警文字间距'
    },
    {
      name: 'alertLineHeight',
      propType: 'string',
      description: '预警文字行高'
    },
    {
      name: 'alertAlign',
      propType: 'string',
      description: '预警文字对齐'
    },
    {
      name: 'showIcon',
      propType: 'bool',
      description: '显示图标'
    },
    {
      name: 'iconOpacity',
      propType: 'number',
      description: '图标透明度'
    },
    {
      name: 'alertStatus',
      propType: 'string',
      description: '预警状态'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onIconClick',
      propType: 'func',
      description: '图标点击事件'
    },
    {
      name: 'onTextClick',
      propType: 'func',
      description: '文字点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'alertText',
        title: { label: { type: 'i18n', 'en-US': 'alertText', 'zh-CN': '预警文字' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '当前无预警' }
      },
      {
        name: 'iconPath',
        title: { label: { type: 'i18n', 'en-US': 'iconPath', 'zh-CN': '图标路径' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz33.png' }
      },
      {
        name: 'backgroundColor',
        title: { label: { type: 'i18n', 'en-US': 'backgroundColor', 'zh-CN': '背景颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(66,106,144,0.29)' }
      },
      {
        name: 'alertTextColor',
        title: { label: { type: 'i18n', 'en-US': 'alertTextColor', 'zh-CN': '预警文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#00FFF1' }
      },
      {
        name: 'alertFontSize',
        title: { label: { type: 'i18n', 'en-US': 'alertFontSize', 'zh-CN': '预警文字大小' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
      },
      {
        name: 'alertStatus',
        title: { label: { type: 'i18n', 'en-US': 'alertStatus', 'zh-CN': '预警状态' } },
        setter: { componentName: 'SelectSetter', isRequired: false, initialValue: 'none' }
      },
      {
        name: 'showIcon',
        title: { label: { type: 'i18n', 'en-US': 'showIcon', 'zh-CN': '显示图标' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'iconOpacity',
        title: { label: { type: 'i18n', 'en-US': 'iconOpacity', 'zh-CN': '图标透明度' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 1 }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '当前预警',
    screenshot: '',
    schema: {
      componentName: 'CurrentAlert',
      props: {
        width: 460,
        height: 50,
        backgroundColor: 'rgba(66,106,144,0.29)',
        backgroundOpacity: 1,
        iconPath: 'http://localhost:8085/static/images/qixiangfangzhai/bz33.png',
        iconSize: {
          width: 32,
          height: 32
        },
        alertText: '当前无预警',
        alertTextColor: '#00FFF1',
        alertFontSize: 16,
        alertFontWeight: 500,
        alertLetterSpacing: '0.57px',
        alertLineHeight: '24px',
        alertAlign: 'left',
        showIcon: true,
        iconOpacity: 1,
        alertStatus: 'none',
        theme: 'dark'
      }
    }
  }
];

export default {
  ...CurrentAlertMeta,
  snippets
}; 